package pl.edu.romanow.query

import xml.NodeSeq
import com.tinkerpop.gremlin.scala.GremlinScalaPipeline
import net.liftweb.common.Empty
import com.tinkerpop.blueprints.pgm.{Vertex, Edge}
import pl.edu.romanow.model.{GraphVisualisationUtil, Database}
import Database._
import scala.collection.mutable.Set;

/**
 * Created by IntelliJ IDEA.
 * User: jar
 * Date: 29.04.12
 * Time: 11:19
 * To change this template use File | Settings | File Templates.
 */

trait QueryItem {

  def bind(selected: Boolean = true): NodeSeq

  def edges(pipe: GremlinScalaPipeline[Edge, Edge], toDisplay: Set[Edge]): GremlinScalaPipeline[Edge, Edge]

  var take: Boolean

}


object Queries {

  val all = Map(
    ("friends", friends _),
    ("friendsLike", friendsLikes _),
      ("all", allQ _)
  )


  def friends(id: String) = Query(id, (new ConnectionItem("friends") :: Nil))

  def allQ(id: String) = Query(id, Nil)

  def friendsLikes(id: String) = Query(id, (new ConnectionItem("friends") :: new ConnectionItem("likes") :: Nil))


  def allFilters = new ConnectionItem(Empty, true) :: Nil;


}